<template>
	<view class="room-list-container">

		<!-- 列表 -->
		<view v-if="list.length>0">
			<view class="list-box" v-for="listItem in list" >
				<view class="list-box-top flex-box">
					<view class="list-box-top-left  flex-box">
						<view>
							<view>
								<text></text>
								<text>{{listItem.title}}</text>
							</view>
							<view class="list-box-top-left-time-item">
								<text></text>
								<text>{{listItem.createTime}}</text>
							</view>
						</view>
					</view>
					<text class="list-box-top-right-status-item"
						:style="{color:listItem.scoreType === 0?'#c24a5d':'#5ac725' }">{{listItem.scoreDes}}</text>
				</view>
			</view>
		</view>
		<!-- 空数据 -->
		<u-empty v-else mode="list" text="暂无房间" marginTop="100" />

		<!-- 上拉加载 -->
		<!-- <u-loadmore v-if="rooms.length > 0" :status="loadStatus" marginTop="20" /> -->
	</view>
</template>

<script setup>
	import {
		ref,
		onMounted
	} from 'vue'

	import {
		onLoad
	} from '@dcloudio/uni-app'

	import {
		getHouseScoreRecordInfoPageRequest
	} from '/request/house.js';

	import {
		goToInternalPage
	} from '@/utils/jump.js'
	// 模拟数据
	const list = ref([])

	// 加载状态：loadmore / loading / nomore
	const loadStatus = ref('nomore')



	// 模拟加载数据
	const loadData = () => {
		loadStatus.value = 'loading'
		setTimeout(() => {
			//获取房间数据  
			getHouseScoreRecordInfoPageRequest({
				"hosueCode":code.value,
				"pageNumber": 1,
				"rowsPerPage": 10
			}).then((res) => {
				if (res.code == 0) {
					list.value = res.rows
					loadStatus.value = 'nomore'
				}
				console.log('成功', res.message);
			}).catch((err) => {
				console.error('失败', err);
			});



		}, 800)
	}

	onMounted(() => {
		loadData()
	})
    const code = ref('')
	// 页面 onLoad 钩子（可选）
	onLoad((options) => {
		code.value = options.code;
		console.log('房间积分记录页面加载')
	})
</script>

<style lang="scss" scoped>
	.flex-box {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.flex-end {
		justify-content: flex-end;
	}

	.room-list-container {
		background-color: #f8f8f8;
		min-height: 100vh;
		padding-top: var(--status-bar-height);

		.list-box {
			width: 100%;
			padding: 30rpx 20rpx;
			box-sizing: border-box;
			border-bottom: 1px solid #e5e5e5;

			.list-box-top {
				width: 100%;
				margin-bottom: 30rpx;
				align-items: flex-start;

				.list-box-top-left {
					width: 80%;
					justify-content: flex-start;
					gap: 20rpx;
					color: #333;

					.group {
						// width: 300rpx;
					}

					.list-box-top-left-time-item {
						font-size: 14px;
						margin-top: 2px;
						color: #999;
					}
				}
			}

			.list-box-btn {
				width: 100%;
				justify-content: flex-end;

			}
		}
	}

	.room-info {
		display: flex;
		align-items: center;
		margin-top: 6px;
		font-size: 14px;
	}

	.status-row {
		.u-tag {
			margin-left: 4px;
		}
	}
</style>